<%--
  Created by IntelliJ IDEA.
  Insurance: lucas
  Date: 2018/2/1
  Time: 上午9:52
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@include file="../common.jsp"%>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>保险信息编辑--空调小程序后台</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <link rel="stylesheet" href="${ctx}/layui/css/layui.css" media="all" />
    <link rel="stylesheet" href="${ctx}/css/public.css" media="all" />

</head>
<body class="childrenBody">
<form class="layui-form layui-row layui-col-space10">
    <input type="hidden" class="layui-input id" name="id"  value="${info.id}">
    <div class="layui-col-md9 layui-col-xs12">

        <div class="layui-row layui-col-space10">
            <div class="layui-form-item layui-row layui-col-xs12">
                <div class="layui-col-md9 layui-col-xs7">
                    <div class="layui-form-item magt3">
                        <label class="layui-form-label">简介</label>
                        <div class="layui-input-block">
                            <textarea id="demo" style="display: none;">${info.desc}</textarea>
                        </div>
                    </div>
                </div>
            </div>
        </div>

    </div>
    <div class="layui-form-item layui-row layui-col-xs12">
        <div class="layui-input-block">
            <button class="layui-btn layui-btn-sm" lay-submit="" lay-filter="sub">提交</button>
        </div>
    </div>
</form>
<script type="text/javascript" src="${ctx}/layui/layui.js"></script>
<script>
    layui.use(['form','layer','layedit','laydate','upload'],function(){
        var form = layui.form
        layer = parent.layer === undefined ? layui.layer : top.layer,
            laypage = layui.laypage,
            upload = layui.upload,
            layedit = layui.layedit,
            laydate = layui.laydate,
            $ = layui.jquery;
            layedit.set({
                uploadImage: {
                    url: '../upload/uploadOneImg' //接口url
                    ,type: 'post' //默认post
                }
            });
         var layeditIndex=layedit.build('demo'); //建立编辑器
        var upload = layui.upload;

        form.on("submit(sub)",function(data){
            //弹出loading
            var index = top.layer.msg('数据提交中，请稍候',{icon: 16,time:false,shade:0.8});
            $.ajax({
                url: '../information/saveInformation',
                type: 'post',
                async: false,
                data: {
                    id:data.field.id,
                    desc:layedit.getContent(layeditIndex),
                    type:3
                },
                dataType: "json",
                success: function (res) {
                    if (res.code == 200){
                        top.layer.close(index);
                        top.layer.msg("操作成功！",{icon: 6});
                    }else {
                        top.layer.msg(res.msg,{icon: 5});
                    }
                }, error: function () {
                    top.layer.msg("系统异常！", {icon: 6});
                    top.layer.close(index);
                }
            });
            return false;
        });

    });
</script>
</body>
</html>
